package com.ptadmin.report;

import java.io.File;

import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.fluent.Configurations;
import org.apache.commons.configuration2.ex.ConfigurationException;

public class ConfigurationManager {

	private Configurations configs = new Configurations();
	
	private PropertiesConfiguration propertiesConfig = null;
	
	public PropertiesConfiguration getPropertiesConfig() {
		return this.propertiesConfig;
	}
	
	private ConfigurationManager() {
		try {
			this.propertiesConfig = configs.properties(new File("config.properties"));
		} catch (ConfigurationException e) {
			e.printStackTrace();
		}
	}
	
	private static volatile ConfigurationManager instance = new ConfigurationManager();
	
	private static Object locker = new Object();
	
	public static ConfigurationManager getInstance() {
		if (instance == null) {
			synchronized(locker) {
				if (instance == null) {
					instance = new ConfigurationManager();
				}
			}
		}
		return instance;
	}
}
